use "c:\Work_Kaplan\NES Data\NES1992-97\anes_mergedfile_1992to1997.dta" , clear

gen cases=0
replace cases=1 if VPARTIC==25 | VPARTIC==26 | VPARTIC==29 | VPARTIC==30


* weight for panel
* check to determine if this is the correct weight variable
gen wgt1=V960004
gen wgt2=V960005

* gen race
gen white=0
replace white=1 if V960067==1

* trust in gov't
* VAR V960566

* 960566    Pre. How much of the time does R trust the fed govt to do right

* 961251    Post. How much of the time R trusts the govt to do what is right
* 961252    Post. How much of tax money does R think the govt wastes
* 961253    Post. Is govt run by a few big interests or the benefit of all
* 961254    Post. How many of the people in govt are crooked

tab1 V961251 V961252 V961253 V961254

recode V961251 V961252 V961253 V961254 (8/9=.) (0=.)

recode V961251 (3/4=0) (2=0.5)
recode V961252 (1=0) (3=0.5) (5=1)
recode V961253 (1=0) (5=1)
recode V961254 (1=0) (3=0.5) (5=1)

sum V961251 V961252 V961253 V961254
pwcorr V961251 V961252 V961253 V961254

egen trustgovf96=rowmean(V961251 V961252 V961253 V961254)

****************************
****************************


* trust in government

* VAR V926120    NAME-92POST:M5.TRUST IN GOVT                                    
* VAR V926121    NAME-92POST:M6.GOVT WAST TAXS                                   
* VAR V926122    NAME-92POST:M7.BIG INTRTS/ALL                                   
* VAR V926123    NAME-92POST:M8.GOVT CROOKED                                     

gen trustgov1=.
replace trustgov1=0 if V926120==7
replace trustgov1=0.3333 if V926120==5
replace trustgov1=0.66666 if V926120==3
replace trustgov1=1 if V926120==1

gen trustgov2=.
replace trustgov2=0 if V926121==5
replace trustgov2=0.5 if V926121==3
replace trustgov2=1 if V926121==1

gen trustgov3=.
replace trustgov3=0 if V926122==5
replace trustgov3=1 if V926122==1

gen trustgov4=.
replace trustgov4=0 if V926123==5
replace trustgov4=0.5 if V926123==3
replace trustgov4=1 if V926123==1

sum trustgov1 trustgov2 trustgov3 trustgov4
pwcorr trustgov1 trustgov2 trustgov3 trustgov4
egen trustgovf92=rowmean(trustgov1 trustgov2 trustgov3 trustgov4)



******************************
******************************

recode V961244 V961245 (8/9=.) (0=.)
gen effic1=(V961244-1)/4
gen effic2=(V961245-1)/4

egen efficf=rowmean(effic1 effic2)

*******************

**********
* lazy whites V961311
* lazy blacks V961312

* intelligent whties V961314
* intelligent blacks V961315


recode V961311 V961312 V961314 V961315 (8/9=.) (0=.)
gen stereobl1=(V961312-1)/6
gen stereobl2=(V961315-1)/6
gen stereobl3=(V961318-1)/6

egen stereoblf=rowmean(stereobl1 stereobl2)

egen stereoblf13=rowmean(stereobl1 stereobl3)

egen stereoblf123=rowmean(stereobl1 stereobl2 stereobl3)


gen stereowh1=(V961311-1)/6
gen stereowh2=(V961314-1)/6

gen difstereo1=(stereobl1-stereowh1+0.6667)/1.6667
gen difstereo2=(stereobl2-stereowh2+0.6667)/1.6667

egen difstereof=rowmean(difstereo1 difstereo2)

* difference in thermometer scores
* blacks V961029
* whites V961030
* recode V961029 V961030 (996/999=.)
* gen diftherm=(V961030-V961029+85)/185

********************

* racialized policies

* V961208    Post. Does R favor affirmative action in hiring and promotion
* V961209    Post. Does R favor/oppose affir action strongly / not strongly


recode V961209 (8/9=.) (0=.)
gen hire=0
replace hire=0.333 if V961209==4
replace hire=0.666 if V961209==2
replace hire=1 if V961209==1
replace hire=. if V961209==.

* V960487    Pre. R's self-place on aid to blacks scale
* V961210    Post. R's position on aid to blacks - 7 point scale

sum V960487 V961210

recode V960487 V961210 (8/9=.) (0=.)
gen aidpre=(7-V960487)/6
gen aidpost=(7-V961210)/6

***********************

* prospective sociotropic economic evaluation

recode V960388 (8/9=.) (0=.)

gen proecon=(5-V960388)/4

*********************************


* trust in people
* 960567    Pre. Does R think that most people can be trusted
* 961258    Post. Does R think that people can be trusted

recode V961258 (8/9=.) (0=.)

gen trustpf=.
replace trustpf=1 if V961258==1
replace trustpf=0 if V961258==5


****************
* authoritarianism

* these items were not asked in 1996 (though were asked in 1992 and 2000)

*************************

* presidential thermometer
* 960272    Pre. Clinton feeling thermometer
* 961019    Post. Feeling thermometer - Bill Clinton
gen prestherm=V960272
recode prestherm (996/999=.)
gen prestherm1=prestherm/100
sum prestherm1


********************

* authoritarian items NOT included in 1996 NES

*************************


* ideology

recode V960365 (8/9=.)
recode V960366 (0=.) (8=.)

gen ideology=V960365
replace ideology=3 if V960365==4 & V960366==1
replace ideology=5 if V960365==4 & V960366==2
replace ideology=4 if V960365==4 & V960366==3
replace ideology=4 if V960365==4 & V960366==7

replace ideology=3 if V960365==0 & V960366==1
replace ideology=5 if V960365==0 & V960366==2
replace ideology=4 if V960365==0 & V960366==3
replace ideology=0 if V960365==0 & V960366==7

replace ideology=3 if V960365==. & V960366==1
replace ideology=5 if V960365==. & V960366==2
replace ideology=4 if V960365==. & V960366==3
replace ideology=0 if V960365==. & V960366==7

replace ideology=3 if V960365==. & V960366==1
replace ideology=5 if V960365==. & V960366==2
replace ideology=4 if V960365==. & V960366==3
replace ideology=0 if V960365==. & V960366==7
replace ideology=0 if V960365==. & V960366==.

gen ideol1=(ideology)/7

gen ideoldk=0
replace ideoldk=1 if ideology==0

* partisanship
gen pid1=V960420/6
replace pid1=. if V960420==7 | V960420==8 | V960420==9

*********
* control variables

generate south= 0
replace south = 1 if V960109> 39 & V960109< 50 | V960109==54
* label variable south "Reside in South"

* religion V960581 V960582
gen prot=0
replace prot=1 if V960581==1 | V960582==1


* female V960066

gen female=0
replace female=1 if V960066==2

* age V960096 V960605 


gen age=V960605
replace age=. if V960605==98 | V960605==99 | V960605==0 

gen age1829=0
replace age1829=1 if age < 30
replace age1829=. if age==.

gen age3044=0
replace age3044=1 if age>=30 & age<45
replace age3044=. if age==.

gen age4564=0
replace age4564=1 if age>=45 & age<65
replace age4564=. if age==.

gen age65p=0
replace age65p=1 if age>=65
replace age65p=. if age==.

* education V960610

recode V960610 (8/9=.)

gen ba=0
replace ba=1 if V960610==6 | V960610==7


gen degree=.
replace degree=0 if V960610==1 | V960610==2
replace degree=0.25 if V960610==3
replace degree=0.5 if V960610==4 | V960610==5
replace degree=0.75 if V960610==6
replace degree=1 if V960610==7


* household income
recode V960701 (88/99=.)

gen income=V960701/24
replace income=0 if V960701==.

gen incdk=0
replace incdk=1 if V960701==.

*******************

tab cases

tab white if cases==1

keep if cases==1
keep if white==1

sum trustgovf96 trustgovf92 liberf stereoblf hire aidpre aidpost proecon trustpf prestherm1 pid1 ideol1 ideoldk age1829 age3044 age4564 age65p female prot south income incdk degree

pwcorr trustgovf96 trustgovf92 liberf stereoblf proecon trustpf prestherm1 pid1 ideol1 ideoldk age1829 age3044 age4564 age65p female prot south income incdk degree

reg trustgovf96 trustgovf92 stereoblf proecon trustpf prestherm1 pid1 ideol1 ideoldk age3044 age4564 age65p female prot south income incdk degree, r

eststo: reg trustgovf96 trustgovf92 stereoblf proecon trustpf prestherm1 pid1 ideol1 ideoldk age3044 age4564 age65p female prot south income incdk degree [pw=wgt1]

estout using "C:\Work_Kaplan\Govt_Race\govt_race_9296p.txt", style(fixed) stats(N r2_p r2_a ll chi2 F p p_corr, fmt(4 3)) cells("b(star fmt(3))" se(par(`"="("'`")""')fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) replace

eststo clear

********************
* all variables on RHS from 1992


use "C:\Work_Kaplan\NES Data\NES1992-97\anes_mergedfile_1992to1997.dta" , clear

gen cases=0
replace cases=1 if VPARTIC==25 | VPARTIC==26 | VPARTIC==29 | VPARTIC==30

* weight for panel
* check to determine if this is the correct weight variable
gen wgt1=V960004
gen wgt2=V960005

* trust in gov't
* VAR V960566

* 960566    Pre. How much of the time does R trust the fed govt to do right

* 961251    Post. How much of the time R trusts the govt to do what is right
* 961252    Post. How much of tax money does R think the govt wastes
* 961253    Post. Is govt run by a few big interests or the benefit of all
* 961254    Post. How many of the people in govt are crooked

tab1 V961251 V961252 V961253 V961254

recode V961251 V961252 V961253 V961254 (8/9=.) (0=.)

recode V961251 (3/4=0) (2=0.5)
recode V961252 (1=0) (3=0.5) (5=1)
recode V961253 (1=0) (5=1)
recode V961254 (1=0) (3=0.5) (5=1)

sum V961251 V961252 V961253 V961254
pwcorr V961251 V961252 V961253 V961254

egen trustgovf96=rowmean(V961251 V961252 V961253 V961254)

****************************
****************************


* trust in government

* VAR V926120    NAME-92POST:M5.TRUST IN GOVT                                    
* VAR V926121    NAME-92POST:M6.GOVT WAST TAXS                                   
* VAR V926122    NAME-92POST:M7.BIG INTRTS/ALL                                   
* VAR V926123    NAME-92POST:M8.GOVT CROOKED                                     

gen trustgov1=.
replace trustgov1=0 if V926120==7
replace trustgov1=0.3333 if V926120==5
replace trustgov1=0.66666 if V926120==3
replace trustgov1=1 if V926120==1

gen trustgov2=.
replace trustgov2=0 if V926121==5
replace trustgov2=0.5 if V926121==3
replace trustgov2=1 if V926121==1

gen trustgov3=.
replace trustgov3=0 if V926122==5
replace trustgov3=1 if V926122==1

gen trustgov4=.
replace trustgov4=0 if V926123==5
replace trustgov4=0.5 if V926123==3
replace trustgov4=1 if V926123==1

sum trustgov1 trustgov2 trustgov3 trustgov4
pwcorr trustgov1 trustgov2 trustgov3 trustgov4
egen trustgovf92=rowmean(trustgov1 trustgov2 trustgov3 trustgov4)


******************
*******************

recode V926221 V926222 V926223 V926224 V926225 V926226 V926227 V926228 V926229 V926230 V926231 V926232 (0=.)(8/9=.)

gen blackhw=(V926222-1)/6
gen blackin=(7-V926226)/6

egen blackster92=rowmean(blackhw blackin)


*********************
******************

* responsiveness
recode V926102 V926103 (8/9=.) (0=.)

gen effic1=(V926103-1)/4
gen effic2=(V926102-1)/4

egen efficf=rowmean(effic1 effic2)

* social trust
gen trustpf=.
replace trustpf=1 if V926139==1
replace trustpf=0 if V926139==2


* feeling therm toward present president
gen prestherm=V923305
recode prestherm (996/999=.)
gen prestherm1=prestherm/100
sum prestherm1

***************************


* econ prospective
* VAR 000496a   H4. US econ bttr/worse in next year stan
* VAR 000496b   H4.E. US econ bttr/worse in next year ex
* VAR 000497    H4a. How much better US econ in nxt year
* VAR 000498    H4b. How much worse US econ in nxt year
* VAR 000499    H4x. Summary US econ in next year

* VAR 923537 NAME-92PRE: H7.

recode V923537 (8/9=.) (0=.)

gen econpro=.
replace econpro=0 if V923537==5
replace econpro=0.5 if V923537==3
replace econpro=1 if V923537==1

****************
* authoritarianism
* VAR 926019    NAME-92POST:L3/A.CHLD-IND/RSP    
* VAR 926021    NAME-92POST:L3C.-CURIOS/MNNRS                                   
* VAR 926020    NAME-92POST:L3B.-OBED/SLF REL                                   
* VAR 926022    NAME-92POST:L3D.CONSID/WL BEH                                   

recode V926019 V926020 V926021 V926022 (8/9=.) (0=.)

gen auth1=0.5
replace auth1=0 if V926019==1
replace auth1=1 if V926019==5
replace auth1=. if V926019==.

gen auth2=0.5
replace auth2=0 if V926020==5
replace auth2=1 if V926020==1
replace auth2=. if V926020==.

gen auth3=0.5
replace auth3=0 if V926021==1
replace auth3=1 if V926021==5
replace auth3=. if V926021==.

gen auth4=0.5
replace auth4=0 if V926022==1
replace auth4=1 if V926022==5
replace auth4=. if V926022==.

sum auth1 auth2 auth3 auth4
pwcorr auth1 auth2 auth3 auth4
egen authf=rowmean(auth1 auth2 auth3 auth4)


* control variables
* age
gen age=V923903

replace age=. if V923903==98 | V923903==99 | V923903==0 

gen age1829=0
replace age1829=1 if age < 30 & age>16
replace age1829=. if age==.

gen age3044=0
replace age3044=1 if age>=30 & age<45
replace age3044=. if age==.

gen age4564=0
replace age4564=1 if age>=45 & age<65
replace age4564=. if age==.

gen age65p=0
replace age65p=1 if age>=65 & age<98
replace age65p=. if age==.

tab1 age1829 age3044 age4564 age65p

* female
gen female=V924201-1

* race
gen white=0
replace white=1 if V924202==1

gen black=0
replace black=1 if V924202==2

gen other=0
replace other=1 if black==0 & white==0


* prot
gen prot=0
replace prot=1 if V923830==1

* south
gen south=0
replace south=1 if V923017>39 & V923017<50
replace south=1 if V923017==54

* income
gen income=V924104
replace income=0 if V924104==88 | V924104==98 | V924104==99 | V924104==66 | V924104==77

gen inc1=income/24

gen incdk=0
replace incdk=1 if V924104==88 | V924104==98 | V924104==99 | V924104==66 | V924104==77

gen incq1=0
replace incq1=1 if V924104>0 & V924104<12

gen incq2=0
replace incq2=1 if V924104>11 & V924104<17

gen incq3=0
replace incq3=1 if V924104>16 & V924104<20

gen incq4=0
replace incq4=1 if V924104>19 & V924104<25

* tab1 incq1 incq2 incq3 incq4 incdk [iw=wgt]

tab1 incq1 incq2 incq3 incq4 incdk 

* education
tab V923908

gen ba=0
replace ba=1 if V923908==6 | V923908==7

gen degree=.
replace degree=0 if V923908==1 | V923908==2
replace degree=0.25 if V923908==3
replace degree=0.5 if V923908==4 | V923908==5
replace degree=0.75 if V923908==6
replace degree=1 if V923908==7


* partisanship
tab V923634

gen pid7=V923634
replace pid7=. if V923634==7 | V923634==9
replace pid7=3 if V923634==8

gen pid1=pid7/6

* ideology

gen ideology=V923509
replace ideology=. if V923509==8 | V923509==9 | V923509==0

replace ideology=3 if V923511==1
replace ideology=5 if V923511==5
replace ideology=3 if V923512==1
replace ideology=4 if V923512==3
replace ideology=5 if V923512==5

tab ideology, m

recode ideology (.=0)

gen ideol1=ideology/7

gen ideoldk=0
replace ideoldk=1 if ideology==0


gen year=1992

sum trustgovf96 trustgovf92 blackster92 econpro trustpf prestherm1 authf pid1 ideol1 ideoldk age3044 age4564 age65p female prot south inc1 incdk degree if cases==1 & white==1


* reg trustgovf96 blackster92 econpro trustpf prestherm1 authf pid1 ideol1 ideoldk age3044 age4564 age65p female prot south inc1 incdk degree if cases==1 & white==1, r


reg trustgovf96 trustgovf92 blackster92 econpro trustpf prestherm1 authf pid1 ideol1 ideoldk age3044 age4564 age65p female prot south inc1 incdk degree if cases==1 & white==1, r

eststo: reg trustgovf96 trustgovf92 blackster92 econpro trustpf prestherm1 authf pid1 ideol1 ideoldk age3044 age4564 age65p female prot south inc1 incdk degree if cases==1 & white==1 [pw=wgt1]

* estout using "C:\Work_Kaplan\Govt_Race\govt_race_9296panel_92rhs.txt", style(fixed) stats(N r2_a F p, fmt(4 3)) cells("b(star fmt(3))" se(par(`"="("'`")""')fmt(2))) starlevels(* 0.10 ** 0.05 *** 0.01) replace

eststo clear



